package com.yjymm.commonsdk.common.util;

import java.time.LocalDateTime;
import java.time.ZoneOffset;
import java.time.format.DateTimeFormatter;
import java.util.Date;

/**
 * @author panhaoxiong
 * @date 2021-02-18 14:34
 */
public class DateTimeUtils {

    public static String FORMAT_PATTREN_ONE = "yyyy年MM月dd日 HH:mm:ss";


    public static String formatStr (LocalDateTime date, String pattern) {
        return DateTimeFormatter.ofPattern(pattern).format(date);
    }

    public static Date convert2Date(LocalDateTime date) {
        long l = date.toEpochSecond(ZoneOffset.ofHours(8));
        return new Date(l);
    }

}
